import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';

import '../../viewmodel/bed/bed_record_view_model.dart';

class BedRecordFragment extends BaseStatefulMvvmWidget{
  final String bedId;

  BedRecordFragment(this.bedId);

  @override
  State<StatefulWidget> createState() => _BedRecordState();

}


class _BedRecordState extends BaseMvvmListState<BedRecordViewModel,BedRecordFragment>{
  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return loadingContentWidget;
  }

  @override
  Widget createItemWidget(int index) {
    var item = viewModel.listItems[index];
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        CommonText('操作时间：${item.businessTypeName}'),
        Container(height: 10,),
        CommonText('办理业务：${item.createdDate}'),
        Container(height: 10,),
        CommonText('老人姓名：${item.customerName}'),
      ],
    ).addToContainer(padding: EdgeInsets.all(10),decoration: BoxDecoration(
      color:
        Colors.white,borderRadius: 10.borderRadius
    ));
  }

  @override
  EdgeInsets get listPadding => EdgeInsets.symmetric(horizontal: 16,vertical: 16);

  @override
  Widget get separatorDivider => Container(height: 15,);

  @override
  BedRecordViewModel createViewModel() {
    return BedRecordViewModel(context,widget.bedId);
  }

  @override
  bool get canPullUp => true;

}